Skip to main content

Full text of "Arduino"

See other formats


The Electronic Nag 



i 



Make Projects 



build, hack, tweak, share, discover, J 



The Electronic Nag 

Written By: George Tempesta 



f TOOLS: 



Breadboard (1) 

Computer (1) 

Drill and drill bits (1) 

Filed) 

Flush cutter (1) 

Laser cutter (1) 

for custom enclosure 

Screwdriver (1) 

Soldering iron and solder (1) 

USB cabled) 

Wire cutter/stripper (1) 



© PARTS: 



Arduino Uno (1) 

ChronoDot real-time clock module (1) 

Wave Shield (1) 

MakerShieldd) 

from Maker Shed (makershed.com) 

Audio speaker (1) 

LCD display (1) 

Proximity sensor (1) 

Resistor (1) 

Power supply (1) 

Shield stacking headers for Arduino (1) 

Jumper Wire (1) 

Cabled) 

Machine screws (14) 

Nuts (8) 

Machine screws (2) 

Standoffs (1) 

Rubber feet (2) 



Naild) 



© Make Projects 



www.makeprojects.com 



Page 1 of 8 



The Electronic Nag 



Project enclosure (1) 

Machie screws (20) 

for custom laser-cut case instead of 

generic enclosure 

Acrylic (1) 



SUMMARY 

It's been said that "necessity is the mother of invention." It's also been said (at least by me) 
that "forgetting to take out the garbage after a splendid seafood dinner is the mother of an 
angry spouse." 

Hence the need for the NAG (Notification Alert Generator), which you can strategically 
mount on a wall near the bedroom to remind you of important upcoming events and tasks, 
such as taking out the festering garbage. 

The NAG was my first real foray into building one of the crazy devices I've come up with 
over the years. Luckily a friend of mine who is a developer clued me into microcontrollers, 
and then I did some research and learned about the Arduino, its many shields, and the Wave 
Shield kit from the fabulous Adafruit Industries ( http://adafruit.com ), which stores WAV audio 
files that your Arduino can play. 

When it comes to nagging, timing is everything, so this project uses a real-time clock (RTC) 
chip, which also contains a calendar. It also includes an LCD, proximity sensor, and a case 
to house the whole mess. 

I'll assume the reader has the prerequisite knowledge to build and modify an Arduino project 
and associated sketches. If not, head over to http://makezine.com/arduino to get started. 

In my circuit, many of the Arduino's limited number of I/O pins are used by the LCD and 
clock. The Wave Shield needs pins 2, 3, 4, and 5, but the Arduino LiquidCrystal code library 
lets you reassign LCD pins. So I made room for the Wave Shield by moving the pin 
assignments in the library, from LiquidCrystal lcd(12, 11, 5, 4, 3, 2); to LiquidCrystal lcd(9, 
8,7,6,15,14);. 

The purpose of the NAG is to nag someone as they walk by, instead of just throwing out 
reminders at predetermined times, unheard. To achieve this, I used a cheap infrared 

© Make Projects www.makeprojects.com Page 2 of 8 



The Electronic Nag 

proximity sensor, the output of which I connected to the Arduino's analog input pin 2. 




220Q 



i|i 

5V 




LCD 20x4 



00©00®®®0®©®©0 



MakerShield 
potentiometer 



@©@®00 0©©©0©0© 

Arduino Uno 



## 




Proximity 



• This is an opportunity to get the 
whole family involved in the 
project. We fired up my laptop with 
its built-in microphone and held a 
recording session: "It's trash night, 
Daddy!" and "It's recycle night, 
Daddy!" and so on, saving the 
snippets as WAV files formatted to 
Adafruit's specification. 

• NOTE: Digital I/O pin (RX) 
on the Arduino is reserved 
for uploading sketches from your 
computer, so don't use it. 

• To cover as many bases as 
possible, we recorded notifications 
for all the hours of the day, and 
anything else I felt could come into 
play down the road. 




* 



• Record as many sound files 
as possible in a single • 

session, because this keeps the 
ambient sound and overall quality 
the same. Then scale back as 
needed. 



© Make Projects 



www.makeprojects.com 



Page 3 of 8 



The Electronic Nag 




• The 2 shields come as kits, so you need to assemble them. 

• With the MakerShield, do not solder on the short-lead 4- and 8-pin headers; these wi 
hold the Chronodot. 

• And with the Wave Shield, substitute shield stacking headers for the included male 
headers, to let the MakerShield stack on top (first photo). 

• Solder an 8" length of speaker wire from the speaker to the 2 audio out holes behind the 
jack on the Wave Shield. Lastly, connect the LCD pins and test that it works, following 
Adafruit's tutorial. 



© Make Projects 



www.makeprojects.com 



Page 4 of 8 



The Electronic Nag 






ama/iLf%n/vm.'M 



At 4 >* A B c T r ■ * * ti & f* *M * ft m ■ 



. ft fcft Qri 4 Q.ft ft Q ft ft *■-■ '■■ ft O '' Ci C 

a.a nnl *^ n n r*i ■ i* >■ h 4 ^i r"j ft A#j 



>: 4 inr* ft s.ft g <> o * 5 v ft <>ft ft ft-o ft >a 

/, q»riG'.a'iciCiCQOorjH i jr>&-iijCii5-a i *i 
4ft.ft.aft £■ ft 4ft ft ">ft 4 5 'J ft "> ft '■■ 4 

■.-.-.-. ■. ". 1 '/ ft rj fj o 13 4 f^g r, ^ *> ft. 







. 4 ft ft 



^H 



• Before committing to solder, build your circuit on a solderless breadboard. Stack the Wave 
Shield onto the Arduino and wire the LCD and Chronodot to their pins. Then connect the 
PIR sensor with the included cable assembly. 

• With the Arduino 0023 IDE installed (1 .0 is not supported yet), download the project code 
Clock_WAV_Motion_Time_Set.pde and Adafruit AF_Wave library from 
http://makeprojects.eom/v/30 . 

• Install the library in your Arduino directory. Read the comments in the Arduino code to 
change some values for testing, then upload it to your Arduino and test. 

• Once it checks out on a breadboard, cut off a 16-pin strip of male headers (from the Wave 
Shield) and cut the short-lead 8-pin header (from the MakerShield) into a 4-pin header. 

• Transfer the wiring onto the shield, including the 16-pin header for the ribbon cable and the 
two 4-pin headers for the Chronodot. Plug in the Chronodot and solder everything down, 
solder-bridging the header pins to their adjacent wires. 



© Make Projects 



www.makeprojects.com 



Page 5 of 8 



The Electronic Nag 






Stack the MakerShield onto the Wave Shield. Attach the LCD via ribbon cable, making 
sure it connects to the same pins at both ends. Connect the PIR sensor to the 
MakerShield via its included cable. 



© Make Projects 



www.makeprojects.com 



Page 6 of 8 



The Electronic Nag 




• At http://makeprojects.eom/v/30 you can download a template for turning a RadioShack 
project enclosure into a case for the NAG, and also DWG files for laser-cutting a custom 
NAG case out of acrylic. With the RadioShack box, center-punch and drill the holes, then 
use a flush cutter and a file to smooth the edges. 

• Mount the LCD using male-to-female standoffs and 4-40 screws and nuts; the PIR sensor 
with 0-80 screws and nuts; the speaker with 4-40 screws and nuts; and the Arduino using 
4-40 screws, standoffs, and nuts. 

• With either the RadioShack enclosure or the laser-cut acrylic box, add rubber feet to the 
bottom corners where they will rest against the wall. You can hang the NAG on a nail. 



© Make Projects 



www.makeprojects.com 



Page 7 of 8 



Going Further 




• My Arduino sketch assigns the proximity sensor pin as an input and tells the Arduino what 
to do when it sees someone walk by. It also triggers actions based on the time or date. 

• Of course, you can customize the sketch however you want. Tuesday is trash night, so 
mine nags whenever somebody walks by between 7 and 1 1 p.m. But it would be quite 
annoying if it did this every time, so it waits 20 minutes between nags, except for 



^.. .. .wy . . .^y .. ... ^..^. v. ..w w-w-j *....w, ww ... "W..^ — w www. 

scheduled nags at 5 minutes after 7, 8, 9, and 10 p.m. 



• Wednesday follows the same nagging protocol as Tuesday, but with a different WAV file: 
"It's recycle night, Daddy!" In addition to playing proximity-triggered messages, the sketch 
announces the hours between 7 and 10 p.m. and 8 and 10 a.m., and on the LCD it displays 
messages such as "Thirsty Thursday" and "T.G.I.F." Upload your custom sketch to the 
Arduino, using Arduino IDE 0023, and congratulations, you're now being NAGed. 



Going Further 

I hope to enhance the NAG with a touchscreen so it's easy to add new events such as meetings, 
birthdays, and sports events. ("Don't forget to take an apple for the teacher today.") Once the 
touchscreen programming is working, I'll add more functionality. Just wait till the next version! 

This project first appeared in MAKE Volume 30 , page 50. 

This document was last generated on 201 2-1 1 -02 09:1 4:22 AM. 



© Make Projects www.makeprojects.com Page 8 of 8